#pragma once

#include <iostream>
#include "Singleton.h"
#include "Environment2D.h"
#include "RoadMap.h"
#include "Sampler.h"
#include <time.h>

class Planning2D : public Singleton<Planning2D>
{
public:
	Planning2D(void);
	virtual ~Planning2D(void);

	bool init(int argc, char *argv[]);
	void render();
	void getBoundingBox(int& left, int& right, int& top, int& bottom) const;

	void decreaseNumSamplesPerIteration() { numSamplesPerIteration_ = std::max(0, numSamplesPerIteration_ - 100); printNumSamples(); }
	void increaseNumSamplesPerIteration() { numSamplesPerIteration_ += 100; printNumSamples(); }
	void printNumSamples() const { std::cout << "Number of samples per iteration : " << numSamplesPerIteration_ << std::endl; }
	void addSamples();

	void printTimings() const;

protected:
	Environment2D environment_;
	RoadMap roadMap_;
	Sampler* sampler_;

	int numSamplesPerIteration_;
	float radius_;

	clock_t totalTime, samplingTime, clearTime, knnTime, linkTime;

	friend class Singleton<Planning2D>;


};

